<Open Tag=[<{]>
<Close Tag=[}>]>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="frm<{OwnerU}>_<{TableU}>.ascx.vb" Inherits="<{Application}>.frm<{OwnerU}>_<{TableU}>" %>

<asp:Panel ID="detail" runat="server">
    <link rel="stylesheet" href="../Styles/Reset.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="../Styles/Site.css" type="text/css" media="screen" />
    <uc:OkMessageBox ID="ec" runat="server" />
    <h2><{Head}></h2>
    <div style="height: 10px"></div>
    <h2 id="lblMode" runat="server"></h2>
    <div style="height: 10px"></div>
    <asp:Panel ID="pnlGrid" Visible="True" runat="server">
        <div style="text-align: center;">
            <div style="display: inline-block;">
                <asp:DropDownList CssClass="input" ID="cmbFields" Width="150px" runat="server" CausesValidation="False"></asp:DropDownList>
                <asp:DropDownList CssClass="input" ID="cmbCondition" Width="150px" runat="server" CausesValidation="False"></asp:DropDownList>
                <asp:TextBox CssClass="input" ID="txtSearch" Width="100px" runat="server"></asp:TextBox>
                <asp:Button ID="butSearch" Width="70px" Text="Search" runat="server" CausesValidation="False"></asp:Button>
                <asp:Button ID="butShowAll" Width="70px" Text="Show All" runat="server" CausesValidation="False"></asp:Button>
            </div>
        </div>
        <div style="height: 40px"></div>
        <div style="text-align: center;">
            <div style="display: inline-block;">
                <asp:Button ID="btnAddNew" Width="130px" Text="Add New Record" runat="server" CausesValidation="False"></asp:Button>
            </div>
        </div>
        <div>
            <div style="float: left;">
                <asp:DropDownList ID="ddlFile" Width="100px" runat="server" CssClass="input">
                    <asp:ListItem Value=".pdf">Pdf</asp:ListItem>
                    <asp:ListItem Value=".xls">Excel</asp:ListItem>
                    <asp:ListItem Value=".doc">Word</asp:ListItem>
                </asp:DropDownList>
                <asp:Button ID="btnExport" Width="70px" runat="server" Text="Export" CausesValidation="False"></asp:Button>
            </div>
            <div style="float: right;">
                <asp:DropDownList CssClass="input" ID="cmbRecords" Width="100px" runat="server" CausesValidation="False"></asp:DropDownList>
                <asp:Button ID="butRecords" Text="Records" Width="70px" runat="server" CausesValidation="False"></asp:Button>
            </div>
        </div>
        <div style="height: 40px"></div>
        <%-------------------------------------%>
        <div style="text-align: center;">
            <div style="display: inline-block; overflow: auto;">
                <%-----
                    If GridView (grd<{TableU}>) width is bigger than web-page (or screen) width (for Mobile and Tablet)...
                    1) comment above 2 lines, and
                    2) uncomment following 2 lines
                -------%>
                <%--<div style="width: 100%;">
                <div style="overflow: auto;">--%>
                <%-------------------------------------%>
					    <{If Loop}>
        				    	<{IsPKey}>
                <asp:datagrid id="grd<{TableU}>" runat="server" AllowPaging="True" PageSize="5" AutoGenerateColumns="False" AllowSorting="True" DataKeyNames="<{FieldU}>" Font-Size="Medium" >
    					    	<{ExitLoop}>
                                            <{/If Loop}>
                                            <{If Loop}>
                                            	<{IsNotPKey}>
                                            	<{And}>
                                            	<{IsIdentity}>
                <asp:datagrid id="grd<{TableU}>" runat="server" AllowPaging="True" PageSize="5" AutoGenerateColumns="False" AllowSorting="True" DataKeyNames="<{FieldU}>" Font-Size="Medium" >
                                            	<{ExitLoop}>
                                            <{/If Loop}>
                                            <{If Loop}>
                                            	<{IsNotIdentityCount}>
                                            	<{And}>
                                            	<{IsNotPKeyCount}>
                <asp:datagrid id="grd<{TableU}>" runat="server" AllowPaging="True" PageSize="5" AutoGenerateColumns="False" AllowSorting="True" DataKeyNames="<{FieldU}>" Font-Size="Medium" >
                                            	<{ExitLoop}>
                                            <{/If Loop}>
                    <Columns>
								<{If Loop}>
	          							<{IsMoney}>
                        <asp:BoundColumn DataField="<{FieldU}>" SortExpression="<{FieldU}>" HeaderText="<{FieldC}>"  DataFormatString="{0:C}" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" />
                        <asp:TemplateColumn>
                            <ItemTemplate>
                                <asp:Label runat="server" Width="10px"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateColumn>
									<{IsSmallMoney}>
                        <asp:BoundColumn DataField="<{FieldU}>" SortExpression="<{FieldU}>" HeaderText="<{FieldC}>"  DataFormatString="{0:C}" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" />
                        <asp:TemplateColumn>
                            <ItemTemplate>
                                <asp:Label runat="server" Width="10px"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateColumn>
									<{IsCheckBox}>
                        <asp:BoundColumn DataField="<{FieldU}>" SortExpression="<{FieldU}>" HeaderText="<{FieldC}>" />
                        <asp:TemplateColumn>
                            <ItemTemplate>
                                <asp:Label runat="server" Width="10px"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateColumn>
									<{IsNumericUpDown}>
                  							<{And}>
                  							<{IsNotFKey}>
                  							<{And}>
	          							<{IsNotMoney}>
                  							<{And}>
									<{IsNotSmallMoney}>
                        <asp:BoundColumn DataField="<{FieldU}>" SortExpression="<{FieldU}>" HeaderText="<{FieldC}>" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" />
                        <asp:TemplateColumn>
                            <ItemTemplate>
                                <asp:Label runat="server" Width="10px"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateColumn>
									<{IsNumericUpDown}>
                  							<{And}>
                  							<{IsFKey}>
                  							<{And}>
	          							<{IsNotMoney}>
                  							<{And}>
									<{IsNotSmallMoney}>
                        <asp:BoundColumn DataField="<{FieldU}>" SortExpression="<{FieldU}>" HeaderText="<{FieldC}>" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"/>
                        <asp:TemplateColumn>
                            <ItemTemplate>
                                <asp:Label runat="server" Width="10px"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateColumn>
									<{IsDateTimePicker}>
                        <asp:BoundColumn DataField="<{FieldU}>" SortExpression="<{FieldU}>" HeaderText="<{FieldC}>"  DataFormatString="{0:d}" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"/>
                        <asp:TemplateColumn>
                            <ItemTemplate>
                                <asp:Label runat="server" Width="10px"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateColumn>
									<{IsTextBox}>
                        <asp:BoundColumn DataField="<{FieldU}>" SortExpression="<{FieldU}>" HeaderText="<{FieldC}>"  HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"/>
                        <asp:TemplateColumn>
                            <ItemTemplate>
                                <asp:Label runat="server" Width="10px"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateColumn>
									<{IsMaskedTextBox}>
                        <asp:BoundColumn DataField="<{FieldU}>" SortExpression="<{FieldU}>" HeaderText="<{FieldC}>"  HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"/>
                        <asp:TemplateColumn>
                            <ItemTemplate>
                                <asp:Label runat="server" Width="10px"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateColumn>
									<{IsMultilineTextBox}>
                        <asp:BoundColumn DataField="<{FieldU}>" SortExpression="<{FieldU}>" HeaderText="<{FieldC}>"  HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"/>
                        <asp:TemplateColumn>
                            <ItemTemplate>
                                <asp:Label runat="server" Width="10px"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateColumn>
									<{IsRichTextBox}>
                        <asp:BoundColumn DataField="<{FieldU}>" SortExpression="<{FieldU}>" HeaderText="<{FieldC}>"  HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"/>
                        <asp:TemplateColumn>
                            <ItemTemplate>
                                <asp:Label runat="server" Width="10px"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateColumn>
									<{IsComboBox}>
                        <asp:BoundColumn DataField="<{FieldU}>" SortExpression="<{FieldU}>" HeaderText="<{FieldC}>"  HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"/>
                        <asp:TemplateColumn>
                            <ItemTemplate>
                                <asp:Label runat="server" Width="10px"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateColumn>
									<{IsComboBox (Db)}>
                        <asp:BoundColumn DataField="<{RDisplayField}>" SortExpression="<{RDisplayField}>" HeaderText="<{FieldC}>"  HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"/>
                        <asp:TemplateColumn>
                            <ItemTemplate>
                                <asp:Label runat="server" Width="10px"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateColumn>
								<{/If Loop}>
                        <asp:ButtonColumn Text="Edit" ButtonType="PushButton" CommandName="Select" />
                        <asp:TemplateColumn>
                            <ItemTemplate>
                                <asp:Label runat="server" Width="5px"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateColumn>
                        <asp:ButtonColumn Text="Delete" ButtonType="PushButton" CommandName="Select" />
                    </Columns>
                    <ItemStyle HorizontalAlign="Left" />
                    <PagerStyle Mode="NumericPages" HorizontalAlign="Center" CssClass="GridPager" />
                    <AlternatingItemStyle BackColor="AliceBlue" />
                </asp:datagrid><br />
					    <{If Loop}>
        				    	<{IsPKey}>
                <input id="htmlHiddenSortExpression" type="hidden" value="<{FieldU}>" name="htmlHiddenSortExpression" runat="server" />
    					    	<{ExitLoop}>
                                            <{/If Loop}>
                                            <{If Loop}>
                                            	<{IsNotPKey}>
                                            	<{And}>
                                            	<{IsIdentity}>
                <input id="htmlHiddenSortExpression" type="hidden" value="<{FieldU}>" name="htmlHiddenSortExpression" runat="server" />
                                            	<{ExitLoop}>
                                            <{/If Loop}>
                                            <{If Loop}>
                                            	<{IsNotIdentityCount}>
                                            	<{And}>
                                            	<{IsNotPKeyCount}>
                <input id="htmlHiddenSortExpression" type="hidden" value="<{FieldU}>" name="htmlHiddenSortExpression" runat="server" />
                                            	<{ExitLoop}>
                                            <{/If Loop}>
            </div>
        </div>
    </asp:panel>
    <asp:panel id="pnlDelete" Visible="False" Runat="server">
        <div style="text-align: center;">
            <div style="display: inline-block; overflow: auto;">
                <h3>Are you sure? Delete this record?</h3>
            </div>
            <div style="height: 10px"></div>
            <div style="display: inline-block; overflow: auto;">
                <asp:Button ID="butYes" Text="Yes" runat="server" CausesValidation="False" Width="75"></asp:Button>
            </div>
            <div style="display: inline-block; overflow: auto;">
                <asp:Button ID="butNo" Text="No" runat="server" CausesValidation="False" Width="75"></asp:Button>
            </div>
        </div>
        <div style="height: 40px"></div>
    </asp:Panel>
    <asp:Panel ID="pnlForm" Visible="False" runat="server">
					    <{If Loop}>
	        				<{IsCheckBox}>
        <div style="text-align: center;">
            <div style="display: inline-block; width: 100px; text-align: left;">
                <{FieldC}>:
            </div>
            <div style="display: inline-block; width: 300px;">
                <asp:checkbox id="txt<{FieldU}>" width="100px" runat="server" CssClass="CheckBox" style="float: left;"></asp:checkbox>
	        				<{IsCheckBox}>
            </div>
        </div>
						<{IsNumericUpDown}>
        <div style="text-align: center;">
            <div style="display: inline-block; width: 100px; text-align: left;">
                <{FieldC}>:
            </div>
            <div style="display: inline-block; width: 300px;">
                <asp:textbox id="txt<{FieldU}>" width="100px" runat="server" CssClass="input" style="float: left; text-align: right;"></asp:textbox>
                            			<{IsNumericUpDown}>
						<{And}>
						<{IsDecimal}>
                <asp:RegularExpressionValidator id="rev<{FieldU}>" runat="server" ErrorMessage="Please enter valid value." Display="Dynamic" ValidationExpression="\d+[.]?[\d]{0,4}" ControlToValidate="txt<{FieldU}>"></asp:RegularExpressionValidator>
						<{IsNumericUpDown}>
						<{And}>
						<{IsNumeric}>
                <asp:RegularExpressionValidator id="rev<{FieldU}>" runat="server" ErrorMessage="Please enter valid value." Display="Dynamic" ValidationExpression="\d+" ControlToValidate="txt<{FieldU}>"></asp:RegularExpressionValidator>
						<{IsNumericUpDown}>
						<{And}>
						<{IsNotNull}>
                <asp:RequiredFieldValidator id="rfv<{FieldU}>" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txt<{FieldU}>"></asp:RequiredFieldValidator>
						<{IsNumericUpDown}>
            </div>
        </div>
						<{IsDateTimePicker}>
        <div style="text-align: center;">
            <div style="display: inline-block; width: 100px; text-align: left;">
                <{FieldC}>:
            </div>
            <div style="display: inline-block; width: 300px;">
                                     <table>
                                          <tr>
                                               <td>
                <asp:TextBox ID="txt<{FieldU}>"  width="100px" runat="server" CssClass="input"></asp:TextBox>
                                               </td>
                                               <td>
                <asp:ImageButton runat="Server" ID="Image<{FieldU}>" ImageUrl="/images/Calendar.png" AlternateText="Click to show calendar" CausesValidation="False" /><br />
                <ajaxToolkit:CalendarExtender ID="calendarButtonExtender<{FieldU}>" runat="server" TargetControlID="txt<{FieldU}>" PopupButtonID="Image<{FieldU}>" />
                                               </td>
                                          </tr>
                                     </table>
						<{IsDateTimePicker}>
						<{And}>
						<{IsNotNull}>
                <asp:RequiredFieldValidator id="rfv<{FieldU}>" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txt<{FieldU}>"></asp:RequiredFieldValidator>
						<{IsDateTimePicker}>
            </div>
        </div>
						<{IsTextBox}>
        <div style="text-align: center;">
            <div style="display: inline-block; width: 100px; text-align: left;">
                <{FieldC}>:
            </div>
            <div style="display: inline-block; width: 300px;">
                <asp:textbox id="txt<{FieldU}>" width="300px" runat="server" CssClass="input"></asp:textbox>
						<{IsTextBox}>
						<{And}>
						<{IsNotNull}>
                <asp:RequiredFieldValidator id="rfv<{FieldU}>" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txt<{FieldU}>"></asp:RequiredFieldValidator>
						<{IsTextBox}>
            </div>
        </div>
						<{IsMaskedTextBox}>
        <div style="text-align: center;">
            <div style="display: inline-block; width: 100px; text-align: left;">
                <{FieldC}>:
            </div>
            <div style="display: inline-block; width: 300px;">
                <asp:textbox id="txt<{FieldU}>" width="300px" runat="server" CssClass="input"></asp:textbox>
						<{IsMaskedTextBox}>
						<{And}>
						<{IsNotNull}>
                <asp:RequiredFieldValidator id="rfv<{FieldU}>" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txt<{FieldU}>"></asp:RequiredFieldValidator>
						<{IsMaskedTextBox}>
            </div>
        </div>
						<{IsMultilineTextBox}>
        <div style="text-align: center;">
            <div style="display: inline-block; width: 100px; text-align: left;">
                <{FieldC}>:
            </div>
            <div style="display: inline-block; width: 300px;">
                <asp:textbox id="txt<{FieldU}>" width="300px" runat="server" CssClass="input"></asp:textbox>
						<{IsMultilineTextBox}>
						<{And}>
						<{IsNotNull}>
                <asp:RequiredFieldValidator id="rfv<{FieldU}>" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txt<{FieldU}>"></asp:RequiredFieldValidator>
						<{IsMultilineTextBox}>
            </div>
        </div>
						<{IsRichTextBox}>
        <div style="text-align: center;">
            <div style="display: inline-block; width: 100px; text-align: left;">
                <{FieldC}>:
            </div>
            <div style="display: inline-block; width: 300px;">
                <asp:textbox id="txt<{FieldU}>" width="300px" runat="server" CssClass="input"></asp:textbox>
						<{IsRichTextBox}>
						<{And}>
						<{IsNotNull}>
                <asp:RequiredFieldValidator id="rfv<{FieldU}>" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txt<{FieldU}>"></asp:RequiredFieldValidator>
						<{IsRichTextBox}>
            </div>
        </div>
           					<{IsComboBox}>
        <div style="text-align: center;">
            <div style="display: inline-block; width: 100px; text-align: left;">
                <{FieldC}>:
            </div>
            <div style="display: inline-block; width: 300px;">
                <asp:DropDownList id="txt<{FieldU}>" width="300px" runat="server" CssClass="input"></asp:DropDownList>
						<{IsComboBox}>
						<{And}>
						<{IsNotNull}>
                <asp:RequiredFieldValidator id="rfv<{FieldU}>" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txt<{FieldU}>"></asp:RequiredFieldValidator>
           					<{IsComboBox}>
            </div>
        </div>
           					<{IsComboBox (Db)}>
        <div style="text-align: center;">
            <div style="display: inline-block; width: 100px; text-align: left;">
                <{FieldC}>:
            </div>
            <div style="display: inline-block; width: 300px;">
                <asp:DropDownList id="txt<{FieldU}>" width="300px" runat="server" CssClass="input"></asp:DropDownList>
						<{IsComboBox (Db)}>
						<{And}>
						<{IsNotNull}>
                <asp:RequiredFieldValidator id="rfv<{FieldU}>" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txt<{FieldU}>"></asp:RequiredFieldValidator>
           					<{IsComboBox (Db)}>
            </div>
        </div>
                                        <{/If Loop}>
        <div style="height: 40px"></div>
    </asp:Panel>
    <asp:Panel ID="pnlSave" Visible="False" runat="server">
        <div style="text-align: center;">
            <div style="display: inline-block; overflow: auto;">
                <asp:Button ID="butCancel" Text="Cancel" runat="server" CausesValidation="False" Width="100"></asp:Button>
            </div>
            <div style="display: inline-block; overflow: auto;">
                <asp:Button ID="btnSave" Text="Save Changes" runat="server" Width="100"></asp:Button>
            </div>
        </div>
        <div style="height: 40px"></div>
    </asp:Panel>
    <asp:Panel ID="pnlMessage" Visible="False" runat="server">
        <div style="text-align: center;">
            <div style="display: inline-block; overflow: auto;">
                <asp:Label ID="lblMessage" runat="server"></asp:Label>
            </div>
            <div style="display: inline-block; overflow: auto;">
                <asp:Button ID="butOK" Text="OK" runat="server" Width="50"></asp:Button>
            </div>
        </div>
        <div style="height: 40px"></div>
    </asp:Panel>
</asp:Panel>
<Open Tag=[<]>
<Close Tag=[>]>
